package yf.mall.vo.up;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;



import yf.mall.entity.AppMaterialEntity;
import yf.mall.vo.AppMaterialVo;

                    import yf.mall.enums.AppMaterialFileTypeEnum;
                            
/**
 * 素材信息表实体
 * 表名 app_material
 *
 *
 *
 * @date Tue Jul 18 14:30:26 CST 2023
 */
@Data
public class AppMaterialUp implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

                        //主键，素材ID
            @ExcelProperty("主键，素材ID")
            private Long id;
        
                        //素材标题
            @ExcelProperty("素材标题")
            private String title;
        
                        //IMG-素材封面
            @ExcelProperty("IMG-素材封面")
            private String cover;
        
                        //ENUM-素材类型：视频、图片、音频、文本:"视频-1","图片-2","音频-3","文本-0"
            @ExcelIgnore
            private Integer fileType;
                        @ExcelProperty("素材类型：视频、图片、音频、文本")
            private String fileTypeStr;
        
                        //素材分类，具体参考材料分类接口
            @ExcelProperty("素材分类，具体参考材料分类接口")
            private Long type;
        
                        //发布时间
            @ExcelProperty("发布时间")
            private Date publishTime;
        
                        //素材大小
            @ExcelProperty("素材大小")
            private Integer size;
        
                        //视频素材时长
            @ExcelProperty("视频素材时长")
            private Integer times;
        
                        //素材地址
            @ExcelProperty("素材地址")
            private String url;
        
                        //素材内容
            @ExcelProperty("素材内容")
            private String content;
        
    
    public AppMaterialUp() {

    }

    public AppMaterialVo toVo() {

        AppMaterialEntity entity = new AppMaterialEntity();
            AppMaterialVo vo = new AppMaterialVo(entity);
                                    entity.setId(id);
            
                                    entity.setTitle(title);
            
                                    entity.setCover(cover);
            
                                    if (getFileTypeStr() != null) {
                    entity.setFileType(AppMaterialFileTypeEnum.nameOf(getFileTypeStr()));
                }
            
                                    entity.setType(type);
            
                                    entity.setPublishTime(publishTime);
            
                                    entity.setSize(size);
            
                                    entity.setTimes(times);
            
                                    entity.setUrl(url);
            
                                    entity.setContent(content);
            
        
        return  vo;
    }



}
